package unit7;

import java.util.Date;

/**
 * @author v_irlwang
 * @date 2021/4/1
 */
public class Example {

    private static final Date thisDate = new Date();

    /**
     * 例1
     * before refactoring
     */
    public void test1() {
        Date date = new Date(thisDate.getYear(), thisDate.getMonth(), thisDate.getDate() + 1);
    }


    /**
     * after refactoring
     */
    public void test2() {
        Date date = getDate(thisDate);
    }

    private Date getDate(Date arg) {
        return new Date(arg.getYear(), arg.getMonth(), arg.getDate() + 1);
    }
}



